package Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-26
 * Time: 17:06
 */


class Teacher{
    private String name;
    private int age;


    class Friend{
        private String name;
        private int age;
        private int height;
        {
            name = Teacher.this.name;
        }
    }

}


public class Test {

    public static void main(String[] args) {
        Teacher teacher = new Teacher();
        Teacher.Friend friend1 = teacher.new Friend();
        Teacher.Friend friend2 = new Teacher().new Friend();

    }
    public static void main3(String[] args) {
        List<String> list = new ArrayList<>();

        list.add("ssss");
        list.add("bbb");
        list.add("ccc");

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            iterator.next();
        }
        iterator.remove();
        System.out.println(list);
       // String str = list.set(2,"ddd");
        //System.out.println(str);
        //System.out.println(list.get(2));
    }

    public static void main2(String[] args) {
        String str = "asdadwWD";
        char[] chars = str.toCharArray();
        for(int i = 0; i < chars.length; i++){
            if(chars[i]>= 65 && chars[i] <= 122){
                if(chars[i] >= 97){
                    chars[i] = Character.toLowerCase(chars[i]);
                }
            }
        }
        System.out.println(new String(chars));
    }

    public static void main1(String[] args) {
        String str = "dfdfds";
        str = str.substring(2);
        System.out.println(str);
        char[] chars = str.toCharArray();
        chars[1] = chars[1];

        String str2 =  "     Hello,       my name is John      ";
        int ret = wordnum(str2);
        System.out.println(ret);

    }

    public static int wordnum(String str){
        str = str.trim();
        int amount = 0;
        String[] strings = str.split(" ");
        for (int i = 0; i < strings.length; i++) {
            if (strings[i].equals("")){
                i++;
                continue;
            }
            amount++;
        }
        return amount;
    }
}
